home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / fractal / kaos.lha / symbollib / circle.c < prev    next >
Encoding:
C/C++ Source or Header  |  1989-11-18  |  803 b   |  42 lines

  1. /*
  2. ### draw a circle ###
  3.  
  4. Bug: need to work on it: circle is not really a circle!
  5. */
  6.  
  7. #include <suntool/sunview.h>
  8. #define SQRT2 1.4142135623730950
  9. static int npts[1] = {8};
  10. static struct pr_pos vlist[8];
  11.  
  12. circle(pw,xp,yp,s,color,p_type)
  13. Pixwin *pw;
  14. int xp,yp,s,color,p_type;
  15. {
  16.     int s2;
  17.  
  18.     s2 = s/SQRT2;
  19.     vlist[0].x = s;
  20.     vlist[0].y = 0;
  21.     vlist[1].x = s2;
  22.     vlist[1].y = s2;
  23.     vlist[2].x = 0;
  24.     vlist[2].y = s;
  25.     vlist[3].x = -s2;
  26.     vlist[3].y = s2;
  27.     vlist[4].x = -s;
  28.     vlist[4].y = 0;
  29.     vlist[5].x = -s2;
  30.     vlist[5].y = -s2;
  31.     vlist[6].x = 0;
  32.     vlist[6].y = -s;
  33.     vlist[7].x = s2;
  34.     vlist[7].y = -s2;
  35.         if(p_type==0){
  36.         pw_polygon_2(pw,xp,yp,1,npts,vlist,PIX_SRC | PIX_COLOR(color),0,0,0);
  37.         }
  38.         else {
  39.         pw_polygon_2(pw,xp,yp,1,npts,vlist,PIX_SRC ^ PIX_DST | PIX_COLOR(color),0,0,0);
  40.         }
  41. }
  42.